import request from "@/utils/http/axios/Axios.ts";
import type {
    TradeMarkResponse,
    tradeMark
} from "@/api/product/trademark/type";
import {TradeMarkResp} from "@/api/product/trademark/type";

enum API {
    // 获取已有品牌接口
    TRADEMARK_URL = '/admin/product/baseTrademark',
    ADD_TRADEMARK_URL = '/admin/product/baseTrademark/save',
    UPDATE_TRADEMARK_URL = '/admin/product/baseTrademark/update',
    REMOVE_TRADEMARK_URL = '/admin/product/baseTrademark/remove',
}


export const trademarkPage = (page: number, limit: number) => request.get<any, TradeMarkResponse>(API.TRADEMARK_URL + `/${page}/${limit}`)

export const trademarkAddOrUpdate = (data: tradeMark) => {
    if (data.id) {
        return request.put<any, TradeMarkResp>(API.UPDATE_TRADEMARK_URL, data)
    } else {
        return request.post<any, TradeMarkResp>(API.ADD_TRADEMARK_URL, data)
    }
}
export const removeTrademark = (id: number) => request.delete<any, TradeMarkResp>(API.REMOVE_TRADEMARK_URL + `/${id}`)
